home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_07 / 1n07034b < prev    next >
Text File  |  1990-11-14  |  433b  |  26 lines

  1.  
  2. LISTING 2
  3.  
  4. /* routine to read data that is
  5.    available on the network descriptor
  6.    nd. reads len bytes of data.
  7.  */
  8.  
  9. #define BUFFSIZE 512
  10.  
  11. void read_data(int nd)
  12. {
  13.     char buffer[BUFFSIZE];
  14.  
  15.     do {
  16.         len = net_read(nd,
  17.                       buffer, BUFFSIZE,
  18.                       (struct addr *) NULL, 0);
  19.         if (len < 0)
  20.             pneterror("net_read");
  21.         else
  22.             write(file, buffer, len);
  23.     } while (len >= 0);
  24. }
  25.  
  26.